<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
Netty WebSocket Timer Service
</head>
<br>
<body>
<br>
<script type="text/javascript">
var socket;
if (!window.WebSocket) 
{
	window.WebSocket = window.MozWebSocket;
}
if (window.WebSocket) {
	socket = new WebSocket("wss://localhost:8989/");
	socket.onmessage = function(event) {
		var ta = document.getElementById('responseText');
		ta.value="";
		ta.value = event.data
	};
	socket.onopen = function(event) {
		var ta = document.getElementById('responseText');
		ta.value = "Open WebSocket success，Browser support WebSocket!";
	};
	socket.onclose = function(event) {
		var ta = document.getElementById('responseText');
		ta.value = "";
		ta.value = "WebSocket closed!"; 
	};
}
else
	{
	alert("Sorry，Your browser is not support WebSocket!");
	}

function send(message) {
	if (!window.WebSocket) { return; }
	if (socket.readyState == WebSocket.OPEN) {
		socket.send(message);
	}
	else
		{
		  alert("WebSocket can't connect server!");
		}
}
</script>
<form onsubmit="return false;">
<input type="text" name="message" value="Netty example"/>
<br><br>
<input type="button" value="Send WebSocket message" onclick="send(this.form.message.value)"/>
<hr color="blue"/>
<h3>Server response message</h3>
<textarea id="responseText" style="width:500px;height:300px;"></textarea>
</form>
</body>
</html>